package cn.hackcloud.demo.dubbo.service;

import cn.hackcloud.demo.dubbo.rpc.IUserService;
import com.alibaba.fastjson.JSON;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.ServiceConfig;

public class AbstractProvider {
    public ServiceConfig getServiceConfig() {
        ServiceConfig<IUserService> serviceConfig = new ServiceConfig();
        serviceConfig.setApplication(new ApplicationConfig("provider"));
        serviceConfig.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
        serviceConfig.setInterface(IUserService.class);
        serviceConfig.setRef(new UserServiceImpl());
        serviceConfig.setGroup("hackcloud");
        serviceConfig.setVersion("1.0");
        return serviceConfig;
    }

    static void print(Object o) {
        System.out.println(JSON.toJSONString(o));
    }


}
